In object-oriented programming (OOP), a factory is an object used to create other objects. An object is typically created by specifying an interface to the factory rather than the concrete class that implements that interface. This provides an abstraction that allows the creation of objects without specifying the exact class of object that is to be created. A similar concept exists in prototype-based programming such as JavaScript®, in which a factory provides an abstraction of a prototype object.
This factory pattern is relatively inflexible, and often results in the creation of a number of redundant interfaces.